.class Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;
.super Landroid/os/AsyncTask;
.source "EvernoteOAuthActivity.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/evernote/client/android/EvernoteOAuthActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "BootstrapAsyncTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        "Ljava/lang/String;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;


# direct methods
.method private constructor <init>(Lcom/evernote/client/android/EvernoteOAuthActivity;)V
    .registers 2

    .prologue
    .line 393
    iput-object p1, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/evernote/client/android/EvernoteOAuthActivity;Lcom/evernote/client/android/EvernoteOAuthActivity$1;)V
    .registers 3
    .param p1, "x0"    # Lcom/evernote/client/android/EvernoteOAuthActivity;
    .param p2, "x1"    # Lcom/evernote/client/android/EvernoteOAuthActivity$1;

    .prologue
    .line 393
    invoke-direct {p0, p1}, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;-><init>(Lcom/evernote/client/android/EvernoteOAuthActivity;)V

    return-void
.end method


# virtual methods
.method protected bridge synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .registers 3

    .prologue
    .line 393
    check-cast p1, [Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method protected varargs doInBackground([Ljava/lang/Void;)Ljava/lang/String;
    .registers 14
    .param p1, "params"    # [Ljava/lang/Void;

    .prologue
    const/4 v9, 0x0

    .line 402
    const/4 v7, 0x0

    .line 405
    .local v7, "url":Ljava/lang/String;
    :try_start_2
    invoke-static {}, Lcom/evernote/client/android/EvernoteSession;->getOpenSession()Lcom/evernote/client/android/EvernoteSession;

    move-result-object v6

    .line 406
    .local v6, "session":Lcom/evernote/client/android/EvernoteSession;
    if-eqz v6, :cond_60

    .line 408
    invoke-virtual {v6}, Lcom/evernote/client/android/EvernoteSession;->getBootstrapSession()Lcom/evernote/client/android/BootstrapManager;

    move-result-object v8

    invoke-virtual {v8}, Lcom/evernote/client/android/BootstrapManager;->getBootstrapInfo()Lcom/evernote/client/android/BootstrapManager$BootstrapInfoWrapper;

    move-result-object v3

    .line 410
    .local v3, "infoWrapper":Lcom/evernote/client/android/BootstrapManager$BootstrapInfoWrapper;
    if-eqz v3, :cond_60

    .line 411
    invoke-virtual {v3}, Lcom/evernote/client/android/BootstrapManager$BootstrapInfoWrapper;->getBootstrapInfo()Lcom/evernote/edam/userstore/BootstrapInfo;

    move-result-object v2

    .line 412
    .local v2, "info":Lcom/evernote/edam/userstore/BootstrapInfo;
    if-eqz v2, :cond_60

    .line 413
    iget-object v10, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    invoke-virtual {v2}, Lcom/evernote/edam/userstore/BootstrapInfo;->getProfiles()Ljava/util/List;

    move-result-object v8

    check-cast v8, Ljava/util/ArrayList;

    # setter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mBootstrapProfiles:Ljava/util/ArrayList;
    invoke-static {v10, v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$702(Lcom/evernote/client/android/EvernoteOAuthActivity;Ljava/util/ArrayList;)Ljava/util/ArrayList;

    .line 414
    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mBootstrapProfiles:Ljava/util/ArrayList;
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$700(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/util/ArrayList;

    move-result-object v8

    if-eqz v8, :cond_60

    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mBootstrapProfiles:Ljava/util/ArrayList;
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$700(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/util/ArrayList;

    move-result-object v8

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    if-lez v8, :cond_60

    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSelectedBootstrapProfilePos:I
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$800(Lcom/evernote/client/android/EvernoteOAuthActivity;)I

    move-result v8

    iget-object v10, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mBootstrapProfiles:Ljava/util/ArrayList;
    invoke-static {v10}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$700(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/util/ArrayList;

    move-result-object v10

    invoke-virtual {v10}, Ljava/util/ArrayList;->size()I

    move-result v10

    if-ge v8, v10, :cond_60

    .line 416
    iget-object v10, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mBootstrapProfiles:Ljava/util/ArrayList;
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$700(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/util/ArrayList;

    move-result-object v8

    iget-object v11, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSelectedBootstrapProfilePos:I
    invoke-static {v11}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$800(Lcom/evernote/client/android/EvernoteOAuthActivity;)I

    move-result v11

    invoke-virtual {v8, v11}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Lcom/evernote/edam/userstore/BootstrapProfile;

    # setter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSelectedBootstrapProfile:Lcom/evernote/edam/userstore/BootstrapProfile;
    invoke-static {v10, v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$602(Lcom/evernote/client/android/EvernoteOAuthActivity;Lcom/evernote/edam/userstore/BootstrapProfile;)Lcom/evernote/edam/userstore/BootstrapProfile;

    .line 422
    .end local v2    # "info":Lcom/evernote/edam/userstore/BootstrapInfo;
    .end local v3    # "infoWrapper":Lcom/evernote/client/android/BootstrapManager$BootstrapInfoWrapper;
    :cond_60
    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSelectedBootstrapProfile:Lcom/evernote/edam/userstore/BootstrapProfile;
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$600(Lcom/evernote/client/android/EvernoteOAuthActivity;)Lcom/evernote/edam/userstore/BootstrapProfile;

    move-result-object v8

    if-eqz v8, :cond_7c

    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSelectedBootstrapProfile:Lcom/evernote/edam/userstore/BootstrapProfile;
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$600(Lcom/evernote/client/android/EvernoteOAuthActivity;)Lcom/evernote/edam/userstore/BootstrapProfile;

    move-result-object v8

    invoke-virtual {v8}, Lcom/evernote/edam/userstore/BootstrapProfile;->getSettings()Lcom/evernote/edam/userstore/BootstrapSettings;

    move-result-object v8

    invoke-virtual {v8}, Lcom/evernote/edam/userstore/BootstrapSettings;->getServiceHost()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v8

    if-eqz v8, :cond_85

    .line 423
    :cond_7c
    const-string v8, "EvernoteOAuthActivity"

    const-string v10, "Bootstrap did not return a valid host"

    invoke-static {v8, v10}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    move-object v8, v9

    .line 445
    .end local v6    # "session":Lcom/evernote/client/android/EvernoteSession;
    :goto_84
    return-object v8

    .line 427
    .restart local v6    # "session":Lcom/evernote/client/android/EvernoteSession;
    :cond_85
    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # invokes: Lcom/evernote/client/android/EvernoteOAuthActivity;->createService()Lorg/scribe/oauth/OAuthService;
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1000(Lcom/evernote/client/android/EvernoteOAuthActivity;)Lorg/scribe/oauth/OAuthService;

    move-result-object v5

    .line 429
    .local v5, "service":Lorg/scribe/oauth/OAuthService;
    const-string v8, "EvernoteOAuthActivity"

    const-string v10, "Retrieving OAuth request token..."

    invoke-static {v8, v10}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 430
    invoke-interface {v5}, Lorg/scribe/oauth/OAuthService;->getRequestToken()Lorg/scribe/model/Token;

    move-result-object v4

    .line 431
    .local v4, "reqToken":Lorg/scribe/model/Token;
    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    invoke-virtual {v4}, Lorg/scribe/model/Token;->getToken()Ljava/lang/String;

    move-result-object v10

    # setter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mRequestToken:Ljava/lang/String;
    invoke-static {v8, v10}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1102(Lcom/evernote/client/android/EvernoteOAuthActivity;Ljava/lang/String;)Ljava/lang/String;

    .line 432
    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    invoke-virtual {v4}, Lorg/scribe/model/Token;->getSecret()Ljava/lang/String;

    move-result-object v10

    # setter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mRequestTokenSecret:Ljava/lang/String;
    invoke-static {v8, v10}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1202(Lcom/evernote/client/android/EvernoteOAuthActivity;Ljava/lang/String;)Ljava/lang/String;

    .line 434
    const-string v8, "EvernoteOAuthActivity"

    const-string v10, "Redirecting user for authorization..."

    invoke-static {v8, v10}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 435
    invoke-interface {v5, v4}, Lorg/scribe/oauth/OAuthService;->getAuthorizationUrl(Lorg/scribe/model/Token;)Ljava/lang/String;

    move-result-object v7

    .line 436
    iget-object v8, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSupportAppLinkedNotebooks:Z
    invoke-static {v8}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1300(Lcom/evernote/client/android/EvernoteOAuthActivity;)Z

    move-result v8

    if-eqz v8, :cond_ce

    .line 437
    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v8, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v10, "&supportLinkedSandbox=true"

    invoke-virtual {v8, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_cd
    .catch Lcom/evernote/client/android/BootstrapManager$ClientUnsupportedException; {:try_start_2 .. :try_end_cd} :catch_d0
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_cd} :catch_d3

    move-result-object v7

    .end local v4    # "reqToken":Lorg/scribe/model/Token;
    .end local v5    # "service":Lorg/scribe/oauth/OAuthService;
    .end local v6    # "session":Lcom/evernote/client/android/EvernoteSession;
    :cond_ce
    :goto_ce
    move-object v8, v7

    .line 445
    goto :goto_84

    .line 439
    :catch_d0
    move-exception v0

    .local v0, "cue":Lcom/evernote/client/android/BootstrapManager$ClientUnsupportedException;
    move-object v8, v9

    .line 441
    goto :goto_84

    .line 442
    .end local v0    # "cue":Lcom/evernote/client/android/BootstrapManager$ClientUnsupportedException;
    :catch_d3
    move-exception v1

    .line 443
    .local v1, "ex":Ljava/lang/Exception;
    const-string v8, "EvernoteOAuthActivity"

    const-string v9, "Failed to obtain OAuth request token"

    invoke-static {v8, v9, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_ce
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .registers 2

    .prologue
    .line 393
    check-cast p1, Ljava/lang/String;

    invoke-virtual {p0, p1}, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->onPostExecute(Ljava/lang/String;)V

    return-void
.end method

.method protected onPostExecute(Ljava/lang/String;)V
    .registers 4
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    .line 456
    iget-object v0, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    const/16 v1, 0x65

    invoke-virtual {v0, v1}, Lcom/evernote/client/android/EvernoteOAuthActivity;->removeDialog(I)V

    .line 457
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_1c

    .line 458
    iget-object v0, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mWebView:Landroid/webkit/WebView;
    invoke-static {v0}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1400(Lcom/evernote/client/android/EvernoteOAuthActivity;)Landroid/webkit/WebView;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 463
    iget-object v0, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # invokes: Lcom/evernote/client/android/EvernoteOAuthActivity;->updateTitle()V
    invoke-static {v0}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1500(Lcom/evernote/client/android/EvernoteOAuthActivity;)V

    .line 467
    :goto_1b
    return-void

    .line 465
    :cond_1c
    iget-object v0, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    const/16 v1, 0x2710

    # invokes: Lcom/evernote/client/android/EvernoteOAuthActivity;->exit(I)V
    invoke-static {v0, v1}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$400(Lcom/evernote/client/android/EvernoteOAuthActivity;I)V

    goto :goto_1b
.end method

.method protected onPreExecute()V
    .registers 3

    .prologue
    .line 397
    iget-object v0, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$BootstrapAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    const/16 v1, 0x65

    invoke-virtual {v0, v1}, Lcom/evernote/client/android/EvernoteOAuthActivity;->showDialog(I)V

    .line 398
    return-void
.end method
